import { Base_model } from '../../util/base_model.js';

class Category_model extends Base_model {
  constructor() {
    super();
  }
  
  getCategories(callback) {
    var params = {
      url: '/categories',
      successCallback: function (res) {
        callback && callback(res);
      }
    };
    this.request(params);
  }

  getProductsByCategory(cateogoryId, callback) {
    var params = {
      url:'/products/by_category?id='+cateogoryId,
      successCallback: function(res) {
        callback && callback(res);
      }
    }
    this.request(params);
  }
}

export {Category_model}